package com.qf.myaspect;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * @author Mr.Liu
 * @date 2021/12/14 22:50
 */
@Aspect
@Component
public class MyAspect {
    @Pointcut("execution(* *.*.service.impl.*.*(..))")
    public void pt(){}
    private Object proceed;
    @Around("pt()")
    public Object myAround(ProceedingJoinPoint joinPoint){
        try{
           // System.out.println("执行了前置通知");
            proceed = joinPoint.proceed();
            //System.out.println("执行了后置通知");
            return proceed;
        }catch (Throwable throwable){
            System.out.println("执行了异常通知");
            throwable.getMessage();
        }finally {
           // System.out.println("执行了最终通知");
        }
        return null;
    }
}
